package com.jjh.users.pojo;

import java.util.Date;
import java.util.Map;
import java.util.TreeMap;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField;
import com.jjh.common.pojo.BasePojo;

/**
 * 统计结果的pojo
 * @author MyJjh
 *
 */

public class AStatRes extends BasePojo<AStatRes>
{
	private int id ;
	private Date currDate ;
	private String usersData ;
	private String content ;
	private byte status ;
	@JSONField(format = "yyyy-MM-dd HH:mm:ss")
	private Date createTime;
	@JSONField(format = "yyyy-MM-dd HH:mm:ss")
	private Date updateTime;
	@JSONField(format = "yyyy-MM-dd HH:mm:ss")
	private Date pubTime;

	/* 字符串描述 */
	private String statusStr;
	private JSONObject usersDataJSON ; 
	
	/* 枚举值 */
	private Map<String, Object> enumsMap = new TreeMap<String, Object>();

	/**
	 * 获取一个map; map有两个要素：键和值,而枚举有三个要素:code,info,枚举项
	 * 
	 * @return map的键是:枚举项-code值,值是:info
	 */
	public Map<String, Object> getEnumsMap()
	{
		for (AAdminsEnum enumTemp : AAdminsEnum.values())
		{
			enumsMap.put(enumTemp.toString() + "-" + enumTemp.getCode(), enumTemp.getInfo());
		}
		return enumsMap;
	}

	/**
	 * 根据status的值,和枚举中对应的值, 返回枚举对应的字符串
	 * 
	 * @return
	 */
	public String getStatusStr()
	{
		for (AAdminsEnum enumTemp : AAdminsEnum.values())
		{
			if (enumTemp.toString().startsWith("STATUS_") && enumTemp.getCode() == this.getStatus())
			{
				return enumTemp.getInfo();
			}
		}
		return statusStr;
	}
	
	public JSONObject getUsersDataJSON()
	{
		this.usersDataJSON = JSON.parseObject(usersData);
		return usersDataJSON;
	}

	public int getId()
	{
		return id;
	}

	public void setId(int id)
	{
		this.id = id;
	}

	public Date getCurrDate()
	{
		return currDate;
	}

	public void setCurrDate(Date currDate)
	{
		this.currDate = currDate;
	}

	public String getUsersData()
	{
		return usersData;
	}

	public void setUsersData(String usersData)
	{
		this.usersData = usersData;
	}

	public String getContent()
	{
		return content;
	}

	public void setContent(String content)
	{
		this.content = content;
	}

	public byte getStatus()
	{
		return status;
	}

	public void setStatus(byte status)
	{
		this.status = status;
	}

	public Date getCreateTime()
	{
		return createTime;
	}

	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}

	public Date getUpdateTime()
	{
		return updateTime;
	}

	public void setUpdateTime(Date updateTime)
	{
		this.updateTime = updateTime;
	}

	public Date getPubTime()
	{
		return pubTime;
	}

	public void setPubTime(Date pubTime)
	{
		this.pubTime = pubTime;
	}
	
}
